package com.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.config.WxConfig;
import com.service.IFriendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@Service
public class FriendServiceImpl implements IFriendService {


    @Autowired
    private WxConfig wxConfig;

    @Autowired
    private RedisTemplate redisTemplate;

    public Set commonFriends(Set set1,Set set2){
        List  list1=new ArrayList(set1);
        List list2=new ArrayList(set2);

        redisTemplate.boundSetOps("s1").add(list1.toArray());
        redisTemplate.boundSetOps("s2").add(list2.toArray());

        Set result=redisTemplate.opsForSet().intersect("s1","s2");
        return result;

    }



}
